<%@ page session="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<jsp:include page="../cabecera_home.jsp"></jsp:include>

<script src="static/scripts/jquery.js"></script>
<script>
	$(document).ready(function() {
		$(".flip").click(function() {
			$(".panel").slideToggle("slow");
			var idstock = document.all.idstockhide.value;

			$.ajax({
				url : 'registrar_interes?id=' + idstock,
				success : function(data) {
					//alert('Interes');
				}
			});

		});
	});
</script>


<div class="cuerpo" align="left">
	<br>
	<div class="marco_publicacion" align="left">

		<b class="publicacion_titulo">Stocks - Detalle</b> <br>
		<hr>

		<form:form modelAttribute="stock"
			action="stocks_modificar?id=${stock.id}" method="GET">

			<form:input type="hidden" path="id" />

			<table>
				<caption>Detalle de Stock #${stock.id}</caption>
				<thead>
					<tr>
						<th scope="col">Variedad</th>
						<th scope="col">Color</th>
						<th scope="col">PH</th>
						<th scope="col">NTU</th>
						<th scope="col">Acidez</th>
						<th scope="col">Alcohol</th>
						<th scope="col">Azucar</th>
						<th scope="col">Cosecha</th>
						<th scope="col">Cantidad (Hl)</th>
						<th scope="col">Precio</th>
						<th scope="col">Creado</th>
						<th scope="col">Estado</th>
					</tr>
				</thead>
				<c:choose>
					<c:when test='${empresaPropia}'>
						<tfoot>
							<th scope="row"><a class="home"
								href="stocks_modificar?id=${stock.id}">Modificar</a></th>
							<td colspan="14"><a class="home"
								href="javascript:history.back()"> Volver</a></td>
						</tfoot>
					</c:when>
					<c:otherwise>
						<tfoot>
							<td colspan="14"><a class="home"
								href="javascript:history.back()"> Volver</a></td>
						</tfoot>
					</c:otherwise>
				</c:choose>
				<tbody>
					<tr>
						<th scope="row">${stock.variedad}</th>
						<td scope="row">${stock.color}</td>
						<td scope="row">${stock.ph}</td>
						<td scope="row">${stock.ntu}</td>
						<td scope="row">${stock.acidez}</td>
						<td scope="row">${stock.alcohol}</td>
						<td scope="row">${stock.azucar}</td>
						<td scope="row">${stock.edad}</td>
						<td scope="row">${stock.cantidad} L.</td>
						<td scope="row">$ ${stock.precio}</td>
						<td scope="row"><fmt:formatDate
								value="${stock.fechaCreacionStock}" pattern="MM/dd/yyyy"
								timeZone="GMT" /></td>
						<c:choose>
							<c:when test='${stock.fechaVenta != null}'>
								<td scope="row"><span style="color: red;">Vendido el
										<fmt:formatDate value="${stock.fechaVenta}"
											pattern="MM/dd/yyyy" timeZone="GMT" />
								</span></td>
							</c:when>
							<c:otherwise>
								<td scope="row"><span style="color: green;">Disponible</span></td>
							</c:otherwise>
						</c:choose>
					</tr>
				</tbody>

			</table>
			<br>
			<b>Registro INV:</b> #${stock.idINV}<br>
			<input type="text" id="idstockhide" value="${stock.id}" hidden="true">
			<b>Vencimiento:</b>
			<fmt:formatDate value="${stock.vencimiento}" pattern="MM/dd/yyyy"
				timeZone="GMT" />
			<br>


		</form:form>
	</div>
	<c:if test="${!empresaPropia}">
		<div class="panel" align="left">
			<div class="intereza_producto">
				<a href="empresas_perfil?id=${contacto.id}">
					<div class='intereza_producto_foto'>
						<img class="foto_contacto" src="static/images/maipo-u1343.png"
							alt="imgen_perfil" width="75" height="75" />
					</div>
				</a>
				<div class='intereza_producto_empresa' align="left">
					<a href="empresas_perfil?id=${contacto.id}"><b
						class="publicacion_titulo2">${contacto.razonSocial}</b></a> <br>
					${contacto.actividadPrincipal} | ${contacto.actividadSecundaria} <br>
					${empresa.domicilioReal}<br> <b>Correo electronico</b>
					${contacto.correoElectronico}<br> <b>Telefono</b>
					${contacto.telefono}<br> <b>Sitio Web</b> <a
						href="http://${contacto.sitioWeb}" target="_blank">${contacto.sitioWeb}</a>
				</div>

				<div style="clear: both"></div>
			</div>
		</div>

		<p class="flip">
			<strong>Mostrar/Ocultar Datos Contacto</strong>
		</p>
	</c:if>
	<br>

</div>

<jsp:include page="../pie_de_pagina_compartida.jsp"></jsp:include>